
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 2706
 * @Author : WangRuoyu 
 * @Date : 2023/6/1 9:00
 */

#include "iostream"
#include "vector"

using namespace std;

class Solution {
public:
    int buyChoco(vector<int> &prices, int money) {
        int m1 = 200;
        int m2 = 300;
        for (int i: prices) {
            if (i <= m1) {
                m2 = m1;
                m1 = i;
            } else if (i < m2) {
                m2 = i;
            }
        }
        if (money < m1 + m2) {
            return money;
        } else {
            return money - m1 - m2;
        }
    }
};

int main() {

    return 0;
}